import hashlib
import uuid
from django.conf import settings


def md5(string):
    """ MD5加密 """
    hash_object = hashlib.md5(settings.SECRET_KEY.encode('utf-8'))
    hash_object.update(string.encode('utf-8'))
    return hash_object.hexdigest()


def uuid_code(string):
    uuid_str = str(uuid.uuid4())
    total_str = f"{string}-{uuid_str}"
    return total_str
